home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.uwo.ca!usenet
- From: turnbull@canlon.physics.uwo.ca (David Turnbull)
- Newsgroups: comp.lang.c++
- Subject: "free"ing classes when the "new" is inside a function
- Date: Fri, 15 Mar 1996 16:53:21 GMT
- Organization: University of Western Ontario
- Message-ID: <4ic7a5$94u@falcon.ccs.uwo.ca>
- NNTP-Posting-Host: ditto.physics.uwo.ca
- X-Newsreader: Forte Free Agent 1.0.82
-
- I have code something like
-
- MyClass* Myfunc(){
- Class* value;
- .
- .
- value = new MyClass(........); <- 1 of several possible constructors
- .
- return value;
- }
-
-
- ------ in main---------
- .
- Class* value;
- value=Myfunc();
- .
-
- How do I free up the memory allocated to value?
- delete value won't do it.
-
- Thanks.
-
- David Turnbull
- Department of Physics
- University of Western Ontario
- London, Ontario, Canada
-
-